﻿/******************************************************************************************
*                                                                                         *    
*                              Developed by Bruno Pires                                   *
*                                                                                         *
*                             email: bruno@blastersystems.com                             *
*                               web: www.blastersystems.com                               *
*                              blog: www.blastersystems.com/blog                          *
*                           twitter: brunoacpires                                         *
*                                                                                         *
*                      Software available under GNU LGPL v3 License                       *
*                                                                                         *    
* *****************************************************************************************/  

function getGoogleMaps(contai, latitude, longitude, pushPinTitle, pushPinDescription) {
    /*set the map size*/
    var mapContainer = contai;
    var mapZoom = 17;
    var pushPin = true;
    var mapStyle="G_NORMAL_MAP";
    var mapWidth="584";
    var mapHeight="400";
    document.getElementById(contai).setAttribute('style', 'position:relative; width:' + mapWidth + '; height:' + mapHeight + ';');
    /**/
   
    
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById('' + mapContainer + ''));
        map.setCenter(new GLatLng(latitude, longitude), mapZoom);
        map.setMapType(mapStyle);
        
        if (pushPin) {

            /*For the PushPoint*/
            var point = new GLatLng(latitude, longitude);
            var pushPoint = new GMarker(point);

            var pushPinText = '<div><font size="2" face="Arial"><b>' + pushPinTitle + '</b><br/><br/>' + pushPinDescription + '<br/></font></div>';
            GEvent.addListener(pushPoint, "mouseover", function() { marker.openInfoWindowHtml(pushPinText); });
            pushPoint.openInfoWindowHtml(pushPinText);
            alert(pushPinText);
            
            map.addOverlay(pushPoint);
        }
        
        map.setUIToDefault();
      }
}  